package com.hulman.oms.office.service;

import com.hulman.oms.util.StringUtil;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;

import java.io.*;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.nio.file.Files;
import java.nio.file.StandardOpenOption;

@Service
public class FileService
{
   /* @Value("${file-home}")
    private String fileHome;

    *//**
     *
     * @param outputStream 输出流
     * @param ext 文件名
     * @return
     * @throws IOException
     *//*
    public String saveFile(OutputStream outputStream, String ext) throws IOException
    {
        String uuid = StringUtil.uuid();
        String fileName = uuid + "." + ext;
        Path filePath = Paths.get(fileHome + fileName);
        // 使用Files.newOutputStream创建OutputStream，追加数据到文件
        try (OutputStream os = Files.newOutputStream(filePath, StandardOpenOption.CREATE, StandardOpenOption.APPEND))
        {
            byte[] bytes = data.getBytes();
            os.write(bytes);
        }
    }*/

}
